<<template>
    <div class="news">
       <div class="content-text">
         <p class="header-p">新闻资讯</p>
         <p class="header-p second">实时掌握最前沿的新闻资讯</p>
       </div>
       <div class="img-contnet">
         <div class="item">
          <div class="item-header">
            <div class="icon">
              <img
                src="../assets/image/人事资讯.png"
              >
            </div>
            <div class="left-content">
              <p class="left-content-p">企业新闻</p>
            </div>
            <div class="right-content">
              <p class="right-content-p" @click="getMore">更多 ></p>
            </div>
          </div>
          <div class="item-text">
            <div class="text-list"  v-for="item in newsObj.company" ::key="item.newsId" @click="getNewId(item.newsId)">
              <div class="item-text-head">
                <p class="item-text-head-p">{{ item.title }}</p>
              </div>
              <div class="item-text-content">
                <p class="item-text-content-p">{{ item.desc}}</p>
                <p class="item-text-content-p">{{ item.publishTime }}</p>
              </div>
            </div>
          </div>
         </div>
         <div class="item">
          <div class="item-header">
            <div class="icon">
              <img
                src="../assets/image/外包派遣.png"
              >
            </div>
            <div class="left-content">
              <p class="left-content-p">行业动态</p>
            </div>
            <div class="right-content">
              <p class="right-content-p"  @click="getMore">更多 ></p>
            </div>
          </div>
          <div class="item-text">
            <div class="text-list"  v-for="item in newsObj.industry" ::key="item.newsId" @click="getNewId(item.newsId)">
              <div class="item-text-head">
                <p class="item-text-head-p">{{ item.title }}</p>
              </div>
              <div class="item-text-content">
                <p class="item-text-content-p">{{ item.desc}}</p>
                <p class="item-text-content-p">{{ item.publishTime }}</p>
              </div>
            </div>
          </div>
         </div>
       </div>
    </div>
</template>
<script>
export default {
  props: {
    newsList: Object
  },
  data() {
    return {
      newsObj: {}
    }
  },
  mounted() {
  },
  methods: {
    getMore() {
      this.$router.push({
        path: "/News"
      });
    },
    getNewId(id) {
      this.$router.push({
        path: "/News",
        query: {
          id: id
        }
      });
    }
  },
  watch: {
    newsList(n) {
      this.newsObj = n;
      console.log(this.newsObj);
    }
  }
}
</script>
<style scoped lang="scss">
.news {
  width: 100%;
  height: 600px;
  display: inline-block;
}
.content-text {
  width: 100%;
  height: 60px;
  margin-top: 70px;
}
.header-p {
  color: #000;
  font-size: 32px;
  font-family: PingFangSC-Semibold, PingFang SC;
  font-weight: 600;
  color: rgba(0, 0, 0, 1);
  line-height: 45px;
  text-align: center;
}
.second {
  margin-top: 20px;
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.4);
  line-height: 27px;
}
.img-contnet {
  width: 80%;
  height: 260px;
  margin-left: 10%;
  display: inline-block;
  margin-top: 100px;
}
.item {
  border-radius: 6px;
  border: 1px solid rgba(151, 151, 151, 1);
  width: 43%;
  margin-right: 3%;
  margin-left: 3%;
  height: 230px;
  margin-top: 10px;
  float: left;
}
.item-header {
  width: 100%;
  height: 40px;
  display: inline-block;
  border-bottom: 1px solid #e3e3e3;
}
.icon {
  width: 20px;
  height: 20px;
  margin: 10px;
  float: left;
  img{
    width:auto;
    height:100%;
  }
}
.left-content {
  width: 100px;
  height: 20px;
  margin-top: 10px;
  float: left;
}
.left-content-p {
  font-size: 14px;
  line-height: 20px;
  color: #000;
}
.right-content {
  width: 100px;
  height: 20px;
  margin-top: 10px;
  float: right;
  margin-right: 15px;
}
.right-content-p {
  font-size: 12px;
  line-height: 20px;
  color: #333;
  text-align: right;
}
.item-text {
  width: 100%;
  box-sizing: border-box;
  padding-left: 20px;
  height: 100px;
}
.text-list {
  width: 100%;
  height: 80px;
  cursor: pointer;
}
.item-text-head {
  width: 100%;
  height: 20px;
  margin-top: 15px;
  float:left;
}
.item-text-head-p {
  font-size: 14px;
  line-height: 20px;
  color: #000;
}
.item-text-content {
  width: 100%;
  height: 20px;
  margin-top: 4px;
  float:left;
}
.item-text-content-p {
  width: 97%;
  height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 20px;
  color: #000;
  opacity: 0.5;
}
@media screen and (max-width: 800px) {
  .news{
    height:auto;
    overflow: hidden;
    .content-text{
      margin-top:15px;
      height:auto;
      .header-p{
        font-size:1.2rem;
        line-height:1.5;
        &.second{
          margin-top:0;
          font-size:0.7rem;
        }
      }
    }
    .img-contnet{
      width:100%;
      height:auto;
      overflow: hidden;
      margin:15px 0 0 0;
      box-sizing: border-box;
      padding:0 15px;
      .item{
        width:100%;
        margin:0 0 15px 0;
      }
    }
  }
}
</style>
